Conversation
Move hardcoded prompts from router_tool_selector.rs and permission_judge.rs
into reusable .md template files using the MiniJinja template system.
Changes:
- Add router_tool_selector.md template with {{tools}} and {{query}} variables
- Add permission_judge.md template for read-only operation detection
- Update router_tool_selector.rs to use render_global_file()
- Update permission_judge.rs to use render_global_file() with fallback
- Add proper error handling for template rendering failures
- All existing tests continue to pass
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <[email protected]>
jamadeo
reviewed
Aug 11, 2025
| .placeholder("https://api.example.com/v1/messages") | ||
| .validate(|input: &String| { | ||
| if !input.starts_with("http://") && !input.starts_with("https://") { | ||
| Err("Inputed URL must start with either http:// or https://") |
Collaborator
There was a problem hiding this comment.
Suggested change
| Err("Inputed URL must start with either http:// or https://") | |
| Err("URL must start with either http:// or https://") |
| verify_secret_key(&headers, &state)?; | ||
|
|
||
| let key = name_to_key(&name); | ||
| let key = goose::config::extensions::name_to_key(&name); |
| .clone() | ||
| .unwrap_or_else(|| { | ||
| format!( | ||
| "Custom {} provider", |
Collaborator
There was a problem hiding this comment.
Suggested change
| "Custom {} provider", | |
| "{} (custom)", |
| .to_uppercase() | ||
| .replace(" ", "_") | ||
| .replace("-", "_") | ||
| ); |
Collaborator
There was a problem hiding this comment.
some duplication between here and the CLI, maybe that could be reduced?
| /// custom providers | ||
| #[derive(Debug, Clone, Serialize, Deserialize)] | ||
| #[serde(rename_all = "lowercase")] | ||
| pub enum ProviderEngine { |
Collaborator
There was a problem hiding this comment.
I think we call this "format" elsewhere
| .map_err(|e| anyhow::anyhow!("Failed to parse {}: {}", path.display(), e))?; | ||
|
|
||
| configs.push(config); | ||
| } else { |
| } | ||
| } | ||
|
|
||
| /// load custom providers |
Collaborator
There was a problem hiding this comment.
Suggested change
| /// load custom providers |
| } | ||
|
|
||
| /// load custom providers | ||
| pub fn load_custom_providers(dir: &Path) -> Result<Vec<CustomProviderConfig>> { |
Collaborator
There was a problem hiding this comment.
this also duplicates a bit I think from routes/config_management
| REGISTRY.read().unwrap().all_metadata() | ||
| } | ||
|
|
||
| pub fn refresh_custom_providers() -> Result<()> { |
Collaborator
There was a problem hiding this comment.
any path here that actually returns an error?
Collaborator
|
closing in favor of #3824 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
fixing: #3824